<?php
$_helper = $this->helper('catalog/output');
$catIds = $this->getCatIds();
$hotProducts = $this->getHotProduct();
$zgbHelper = Mage::helper('zgb');
?>
<?php echo $this->getLayout()->createBlock('bannerslider/default')->setTemplate('bannerslider/slider7.phtml')->setBannersliderId(13)->toHtml(); ?>
<div class="category-icon">
	<ul class="clearfix">
		<?php foreach($catIds as $id): ?>
			<li>
				<a href="<?php echo $this->getCatUrl($id) ?>">
					<span><img alt="" src="<?php echo $this->getCatImg($id) ?>" /></span>
				</a>
				<p><?php if($id == 12){ echo '更多'; }else{ echo $this->getCatName($id); } ?></p>
			</li>
		<?php endforeach; ?>
	</ul>
</div>
<div class="hot">
	<div class="hot-title">
		<div class="hot-title-wrapper clearfix">
			<h2 class="left">本期爆款</h2>
			<a class="right" href="<?php echo $this->getUrl('catalog/category/view', array('id'=>'14')) ?>">更多<span class="fa fa-angle-right"></span></a>
		</div>
	</div>
	<div class="hot-content">
		<?php echo $this->getLayout()->createBlock('cms/block')->setBlockId('hot')->toHtml(); ?>
	</div>
</div>
<div class="homepage-adds">
	<?php echo $this->getLayout()->createBlock('bannerslider/default')->setTemplate('bannerslider/slider7.phtml')->setBannersliderId(12)->toHtml(); ?>
</div>
<div class="msg-cont" id="home-message">
	<div class="msg-wrap">
		<?php echo $this->getLayout()->createBlock('cms/block')->setBlockId('app_home_messages')->toHtml(); ?>
	</div>
</div>
<p id="home-message-nav"></p>
<script type="text/javascript">
	window.mySwipe = Swipe(document.getElementById('home-message'), {
		continuous: false,
		callback: function(index, elem) {
			jQuery('.tl-nav').removeClass('active');
			jQuery('.tl-nav').eq(index).addClass('active');
		}
	});
</script>
<?php if(Mage::getSingleton("customer/session")->isLoggedIn()): ?>
<?php array_pop($catIds); ?>
<?php foreach($catIds as $id): ?>
<?php $products = $this->getCatProduct($id); ?>
<?php if(count($products) <= 0) continue; ?>
<div class="cat-product">
	<div class="cat-title">
		<div class="cat-title-wrapper clearfix">
			<h2 class="left"><?php echo $this->getCatName($id) ?></h2>
			<a class="right" href="<?php echo $this->getCatUrl($id) ?>">更多<span class="fa fa-angle-right"></span></a>
		</div>
	</div>
	<div class="cat-content">
		<ul class="clearfix">
			<?php $i=1; foreach($products as $_product): ?>
				<li class="left <?php if($i%3 == 2) echo 'li-margin' ?>">
		            <a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>">
		                <div class="wrap">
		                    <div class="product-image">
		                        <img src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize(256); ?>" width="100" height="100" alt="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" />
		                        <?php if($zgbHelper->hasTag($_product)): ?>
		                        	<div class="product-sale-tag">
		                        		<img src="<?php echo $zgbHelper->getSaleTagUrl($_product, $this->getSkinUrl('images')); ?>" alt="" />
		                        	</div>
		                        <?php endif; ?>
		                    </div>
		                    <div class="product-shop">
		                            <h3><?php echo $_helper->productAttribute($_product, $_product->getName(), 'name') ?></h3>
		                            <?php echo $this->getPriceHtml($_product, true) ?>
		                    </div>
		                </div>
		            </a>
		        </li>
		        <?php $i++; ?>
			<?php endforeach; ?>
		</ul>
	</div>
</div>
<?php endforeach; ?>
<?php endif; ?>